package com.lixi;

import com.lixi.spider.Load;

import java.io.IOException;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * @author lixi
 * @create 2020-02-15:17:51
 */
public class Run {
    public static void main(String[] args) {
        Runnable runnable = new Runnable() {
            public void run() {
                //System.out.println("执行一次");
                Load load=null;
                try {
                    load=new Load("https://ncov.dxy.cn/ncovh5/view/pneumonia");
                    load.jsonLoad("四川省");
                    load.updToMysql();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        };
        //开启一个线程池
        ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(1);
        //定时执行
        executor.scheduleAtFixedRate(runnable,0,1,TimeUnit.MINUTES);
        //executor.shutdownNow(); 这里是关闭ss
    }
}
